package com.aabte.springcloudlearn.eurekaserverproviderdemo.controller;

import com.aabte.springcloudlearn.common.utils.CommonMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Daniel
 */
@Slf4j
@RestController
public class RetryProviderController {

    /**
     * 测试Feign的重试功能，接口延迟1秒钟返回
     */
    @GetMapping("/retry")
    public String feignRetry(){
        log.info("Start feignRetry.");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.error("Sleep error. ex: {}", CommonMethod.getErrorStack(e));
        }
        log.info("End feignRetry.");
        return "OK";
    }

}
